1. Field of the Invention
The present invention relates to an encoding apparatus for encoding input information data, and more particularly to an encoding apparatus encoding input information data while controlling code quantity of encoded information data.
2. Related Background Art
Referring to FIG. 1, prior art encoding used in transmitting or recording digital image information such as a television signal is explained.
FIG. 1 illustrates an example where digital data are grouped into two-dimensional blocks each consisting of vertical Mxc3x97horizontal N pixels (where M and N are integers) in one frame of a television image is processed by an orthogonal conversion and variable length encoding.
In FIG. 1, image data for pixels on a screen is applied to an input unit 1 and the input image data is grouped into Mxc3x97N two-dimensional blocks of image data by a grouping circuit 2, and the pixel data is converted to orthogonally converted block data 5 representing Mxc3x97N frequency components by an orthogonal conversion circuit 4.
Then, the orthogonally converted block data 5 is supplied to a quantization circuit 6 where quantized data is produced and it is supplied to a variable length encoding circuit 8 where it is encoded with variable length.
The variable length encoding circuit 8 rearrange each of the orthogonally converted blocks by zig-zag scanning coefficients from a low frequency end to high frequency end of frequency components. For example, where one orthogonally converted block consists of 8xc3x978 data, the zig-zag scan is, in many cases, conducted in the order shown in FIG. 2. The variable length encoding is conducted to data train representing the one-dimensional frequency components.
The encoded data 10 is formatted by a formatter 11 and the formatted data is outputted from an output unit 14 for transmission or recording.
The code quantity of the data thus encoded is limited depending on a capacity of a medium used for the transmission or recording.
In a prior art method for controlling the code quantity, the code quantity for each orthogonally converted block stored in a buffer 9 or for a plurality of orthogonally converted blocks (hereinafter referred to as a code quantity control block) is counted by a code quantity calculation circuit 12 so that the quantization is conducted with coefficients of a quantization table which meets the object.
When an overflow occurs by failing to suppress to the desired code quantity by an existing quantization table, the code quantity is reduced in the process of formatting by deleting the coefficients in each orthogonally converted blocks as required in the order starting from the high frequency end in which the affect to the decoded image is less.
Assuming that a unit for the code quantity control comprises three orthogonally converted blocks and a run-length Huffman encoding method is used in which the coefficients are classified into zero and non-zero significant coefficients, and a code is defined by a combination of the number of consecutive zero coefficients starting from the low frequency end and significant coefficients following thereto, and an EOB (end of block) code is added following to the last significant coefficient in the block to omit the zero coefficients in the high frequency region, the code quantity control is conducted in such a manner that the formatting is conducted sequentially from the first block as shown in FIGS. 3A, 3B and 3C, and when the target code quantity is reached at the third block from the last, the EOB code is added.
In FIGS. 3A to 3C, the coefficients in a hatched area of solid line blocks represent those coefficients which will be zeros following to the last significant coefficient when they are rearranged in the orthogonally converted block from the low frequency end to the high frequency end. The coefficients in the high frequency region of the orthogonally concerted block sectioned by broken lines represent those coefficients which will be deleted by the code quantity control.
When such a code quantity control method is used, frequency components in some orthogonally converted blocks in relatively low frequency region may be cut away. In addition, it occurs unevenly among the orthogonally converted blocks in the code quantity contort block. As a result, when the transmission or recording is conducted, the decoded image includes deterioration of image quality such as a block distortion and the reproduction of an image which is close to an original image cannot be attained.
The code quantity control block frequently comprises orthogonally converted blocks representing different signals components such as a block representing a luminance signal and a block representing a color difference signal. Accordingly, when the code quantity is to be reduced, it is necessary to conduct weighting for a visual sense characteristic of human being to the orthogonally converted blocks representing the respective signal components.
In the light of the above, it is an object of the present invention to provide an encoding apparatus which prevents encoded data which will not be transmitted because of an overflow caused during the encoding of information data from being concentrated in particular blocks to permit the reproduction of information data which is close to the original information data from the decoded data after transmission or recording. (For example, where the information data is image data, the deterioration of image quality such as block distortion is prevented.)
To achieve the above object, in one aspect of the invention, there is provided an encoding apparatus comprising input means for supplying sampled information data, block forming means for forming blocks of information data supplied by said input means, encoding means for encoding information data outputted from said block forming means, detection means for detecting code quantity of encoded data derived by consolidating and encoding said blocks, one-dimension processing means for applying one-dimension processing to the encoded data of said blocks, and deletion means for deleting the encoded data in accordance with the encoded data processed by said one-dimension processing means in accordance with the output of said detection means.
In another aspect of the invention, there is provided an encoding apparatus comprising input means for supplying sampled image data, encoding means for encoding the image data, detection means for detecting code quantity of the encoded data for each predetermined unit, deletion means for deleting the encoded data in accordance with the output of said detection means, and control means for controlling the deletion process by said deletion means in accordance with signal components of the image data.
In accordance with a further aspect of the invention, there is provided an encoding apparatus for forming blocks of input information data, encoding the formed blocks of information data and writing the encoded data in a transmission format having a predetermined area provided for each block, comprising memory means for storing encoded data which overflows the predetermined area provided for the block when the encoded data is written in the transmission format, measurement means for measuring the encoded data which overflows the predetermined area for each unit comprising a plurality of said blocks, and control means for stopping the transmission of the encoded data stored in said memory means in response to the output of said measurement means.
Other objects and advantages of the invention will become apparent from the following detailed description taken in conjunction with the appended claims.